<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
	<title>竞猜结果</title>
	<link rel="stylesheet" type="text/css" href="https://at.alicdn.com/t/font_474420_nbftp60a4y0newmi.css">
	<link rel="stylesheet" type="text/css" href="css/swiper.min.css">
	<link rel="stylesheet" type="text/css" href="css/style.css?v=1">
	<script type="text/javascript" src="js/fontSize.js"></script>
	<script type="text/javascript" src="js/layer/layer.js"></script>
	<script type="text/javascript" src="js/zepto.min.js"></script>
	<script type="text/javascript" src="js/swiper.min.js"></script>
	<script type="text/javascript" src="js/vue.js"></script>
	<script type="text/javascript" src="js/jweixin-1.2.0.js"></script>
	<script type="text/javascript" src="js/config.js"></script>
	<style type="text/css">
		.padtop{padding-bottom: 1rem;}
	</style>
</head>
<body class="bgcolor quiz_result padtop">
<div id="app">
	<!-- <video src="img/video.mp4" class="video"></video> -->
	<!-- <div class="shop_info">
		<div class="shop_info_name">板栗蛋黄月饼 | 味蕾时光</div>
		<div class="shop_info_text">
			中秋节始于唐朝初年，盛行于宋朝，至明清时，已成
			为与春节齐名的中国传统节日之一。受中华文化的影
			响，中秋节也是东南亚一些国家中当地华人华侨的传
			统节日。
		</div>
	</div> -->
	<ul class="shopList">
		<li class="borderBottom" v-for="(item,index) in resObj">
			<div class="shopList_top">
				<div class="shop_left">
				  <span><img :src="item.good.url" alt=""></span>
			    </div>
			    <div class="shop_right">
			    	<div class="shop_name">{{item.good.name}}</div>
			    	<div class="shop_price"><sub>￥</sub>{{item.coupon.price}}
			    		<i class="iconfont icon-xuanze" v-if="item.flag" @click="select(index)"></i>
			    		<i class="iconfont icon-quan" v-else @click="select(index)"></i>
			    	</div>
			    	<div class="shop_time"><span class="fl">原价<del>￥{{item.good.price}}元</del></span>
			    		<!-- <span class="fr">截止：2017.11.15</span> -->
			    	</div>
			    </div>
			</div>
			<div class="shopList_bottom">
				<div class="shop_buttton" :style="'background-image:url('+item.coupon.url+')'">
					{{item.coupon.desc}}
				</div>
			</div>	
		</li>
	</ul>
	<ul class="tab_footer_li">
		<li @click="goShop">我再看看</li>
		<li @click="goBuy">立即购买</li>
	</ul>
	<!-- 弹窗 -->
	<div class="mask_layer" v-show="popFlag">
		<div class="mask_model"  @click="toogle1"></div>
		<div class="lose_content">
			<div class="loseTitle_div">
				<img src="img/21.png" alt="" class="loseTitle">
			    <div class="loseText">唉，有{{num}}道错题哟~</div>
			</div>
			<ul class="loseTip">
				<li>分享给好友帮您回答错误题目，</li>
				<li>来获取更多折扣吧！</li>
			</ul>
			<button type="button" class="confirm_lose" @click="toogle1">好的</button>
		</div>
	</div>
</div>
	<script type="text/javascript">
		var app = new Vue({
			el: '#app',
			data: {
			    list:[],
			    num:1,
		        unionid:GetQueryString("unionid"),
		        token:GetQueryString("token"),
		        id:GetQueryString("id"),
			    rid:GetQueryString("rid")?GetQueryString("rid"):null,
		        resObj:JSON.parse(localStorage.conpou),
		        mistake:JSON.parse(localStorage.mistake),
		        flag:false,
		        selectedId:null,
		        popFlag:false
			},
			mounted(){
			    for (var i = 0; i < this.resObj.length; i++) {
			    	 this.resObj[i].flag=false;
			    }
			    if(this.mistake.length>0){
			    	 this.popFlag=true; 
			    }
			    this.num=this.mistake.length;
			    // if(this.rid){
       //              window.location.replace("share.html?id="+this.id+"&unionid="+this.unionid+"&rid="+this.rid+"&token="+this.token);   
			    // }
			    console.log(this.resObj)
			    console.log(this.mistake)
			},
			methods:{
				toogle:function(){
					this.flag=!this.flag;
				},
				toogle1:function(){
					this.popFlag=!this.popFlag;
				},
				goBuy:function(){
				   window.location.href="choice.html?token="+this.token+"&unionid="+this.unionid+"&shopId="+this.selectedId;
				},
				goShop(){
					location.href="shop.html?unionid="+this.unionid+"&token="+this.token
				},
				select(n){
                    for (var i = 0; i < this.resObj.length; i++) {
			    	  this.resObj[i].flag=false;
			        } 
			        this.resObj[n].flag=true;
			        this.selectedId=this.resObj[n].good.id;
			        this.resObj= this.resObj.slice();

				},
				getShare:function(){
                  var that=this;
                  ajaxFun1("POST","/get_guess_share_config",{
                     q_id:this.id,
                     qqq:encodeURIComponent(window.location.href)
                  },function(data){
                    var res=data;
                    console.log(data)
                     if(res.code==1){
                         var config=res.data.config;
                          wx.config({
                            debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
                            appId: config.appId, // 必填，公众号的唯一标识
                            timestamp: config.timestamp, // 必填，生成签名的时间戳
                            nonceStr:  config.nonceStr, // 必填，生成签名的随机串
                            signature: config.signature,// 必填，签名，见附录1
                            jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage'] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
                          });
                          var url=that.resObj.share_info.url+that.unionid;
                          var share=shareUrl+encodeURIComponent(httpUrl+url);
                          wx.ready(function(){
                            wx.onMenuShareTimeline({
                                title: "帮帮答题", // 分享标题
                                link:"", // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
                                imgUrl:"", // 分享图标
                                success:function(){
                               
                                  
                                },
                                cancel:function(){

                                }
                            });
                            wx.onMenuShareAppMessage({
                                  title: "1", // 分享标题
                                  desc: "1", // 分享描述
                                  link: "1", // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
                                  imgUrl: "1", // 分享图标
                                  type: 'link', // 分享类型,music、video或link，不填默认为link
                                  dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
                                  success: function () { 
                                  
                                    
                                      // 用户确认分享后执行的回调函数
                                  },
                                  cancel: function () { 
                                      // 用户取消分享后执行的回调函数
                                  }
                              });
                          
                          });
                     }
                            
                  });
                },
			}
		});
	</script>
</body>
</html>